//webView.js
const app = getApp()

const request = require("miniapp-request");

global.Page({
	data: {
		originUrl: '',
		url: "",
		title: "",
		shareMessage: '邀请您参加肿瘤防治健康跑'
	},
	onShareAppMessage: function (res) {
		console.log(this.data)
		return {
			title: this.data.shareMessage || this.data.title,
			path: '/pages/index/index?redirect=/pages/webView/webView&url=' + encodeURIComponent(this.data.originUrl) + '&title=' + this.data.title
		}
	},
	msgHandler(e) {
		this.setData({
			shareMessage: e.detail.data[0].shareMessage
		});
		console.log('msgHandler', e.detail.data[0].shareMessage);
	},
	onLoad: function (options) {
		// 生命周期函数--监听页面加载
		var path = options.url;
		var originUrl = decodeURIComponent(options.url);

		this.setData({
			url: decodeURIComponent(path),
			originUrl
		});

		options.title && this.setData({
			title: options.title,
		});
	}
})